Bitmap images are defined as a fixed grid of pixels and thus are resolution dependent. Therefore, resampling techniques are required to change the resolution of an image, for example by increasing the size of the image. Resampling is the process of changing the size of a digital image by explicitly changing the number of pixels in the image. Using the original image as a template to work out the value for each new pixel, a new bitmap is created having the desired dimensions.
Several resampling techniques are known in the art. Two common methods are known as linear methods. One common linear method is known as the “nearest neighbor” method. This process overlays a new bitmap grid over the original grid and uses the values of the original pixel's coordinates that are closest to the new target pixel's coordinates to generate the new bitmap. In this process, some pixels may align better during the overlay than others. As a result, some original pixels may be used more than once and others may be discarded. The arbitrary nature of this pixel selection process results in visual artifacts. In down scaling, the likely artifacts are moiré patterns, whereas upscaling results in aliasing (jagged edges). With larger size increases, aliasing can become more pronounced, resulting in pixellation.
Referring now to FIG. 3A, there is shown an illustration of a pixel-level resampling process using a prior art “nearest neighbor” method 300. The example shown is a four pixel (2×2) portion of an original grayscale image 305. Each square represents a single pixel 310. The number in each pixel 310 represents the value of each respective pixel 310, with the lowest numbers representing the lightest gray and the highest numbers approaching black. The first step shows a 200% magnification 315 of the original 305. In this example, the 2×2 pixel image 305 is enlarged to 4×4 (16) pixels 315.
After the initial enlargement, the blank pixels are estimated based upon the original four pixels 305. To achieve this, the nearest neighbor method simply repeats the original pixel 310 in both the horizontal and vertical direction, as shown in the output image 320. The arbitrary nature of this pixel selection often results in visual artifacts. In the upscaling context, as with this example, the likely artifacts are jagged edges (aliasing). With larger size increases, aliasing can become more pronounced, resulting in pixilation.
Another known linear resampling method is bicubic interpolation. This method determines a value from the weighted average of the 16 surrounding pixels (in a 4×4 array). The averaging process reduces aliasing compared to the nearest neighbor method, but jagged edges are still visible and there is an accompanying loss of edge definition known as smoothing. The greater the image increases, the more the image edges are smoothed, with increases over 200% appearing as a soft mush. In addition, ringing artifacts, which appear as a halo around the edges, may result from bicubic interpolation. In short, linear methods of resampling cannot effectively eliminate all visual artifacts, and generally result in a tradeoff between aliasing, ringing, and/or blurring.
Referring now to FIG. 3B, there is shown an illustration of a pixel-level resampling process using a prior art bicubic interpolation method 325. The example again begins with a four pixel (2×2) portion of an original grayscale image 305. As with the nearest neighbor resampling method, the first step shows a 200% magnification 315 of the original 305.
Next, the blank pixels are estimated based upon the original four pixels 305 by gradually changing the values between known pixels 305. For example, in the top row the unknown pixel 330a is estimated to have a value of 30, the midpoint the values (10 and 50, respectively) of the known pixels 310 on each side. In the second row, the value of the unknown pixel 330b without known pixels beside it is determined from the estimates of the other (previously unknown) pixels 330 on all four sides. Once this process is complete for all unknown pixels 330, the output image is complete. The bicubic interpolation resampling process reduces visible aliasing, but produces an accompanying loss of edge definition known as smoothing. In addition, ringing artifacts may result, appearing as a halo around the edges.
Another group of resampling methods are known as edge-adaptive methods, such as NEDI (New Edge Directed Interpolation) or S-Spline. These methods use averages like bicubic interpolation, but also look at the value of the pixels, in an effort to detect edges and keep sharper areas sharp. However, these methods also produce undesirable visual artifacts. For example, random pixels may appear in or near smooth image areas such as curves. In addition, small sized, repeating patterns or areas of fine structure do not resample well through these methods, producing unnatural looking results for images depicting objects such as vinyl siding or blades of grass.
Accordingly, there is a need to provide a resampling method, system, and computer program product that provides sharp picture quality and reduces visual artifacts.